/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/

#pragma once

#include <memory>
#include <map>
#include <db/db_types.h>
#include <db/db_interfaces.h>
#include <db/db_index_definition.h>
#include <db/db_tuple_instance.h>

namespace test_wrappers { namespace storage {

class tuple_values
{
public:
    // instantiation
    tuple_values(
        const std::shared_ptr<tuple_instance>& tupleInstance,
        const std::shared_ptr<const std::vector<std::shared_ptr<field_value>>>& fieldValues
        );

    // getters
    std::shared_ptr<field_value_t<unsigned short>> field(
        const field_id_t<unsigned short>& userFieldId
        );

    std::shared_ptr<field_value_t<unsigned int>> field(
        const field_id_t<unsigned int>& userFieldId
        );

    std::shared_ptr<field_value_t<unsigned __int64>> field(
        const field_id_t<unsigned __int64>& userFieldId
        );

    std::shared_ptr<field_value_t<std::wstring>> field(
        const field_id_t<std::wstring>& userFieldId
        );

    std::shared_ptr<field_value_t<binary_blob>> field(
        const field_id_t<binary_blob>& userFieldId
        );

    std::shared_ptr<const std::vector<std::shared_ptr<field_value>>> getValues() const;
    std::shared_ptr<tuple_instance> tupleInstance() const;

protected:
    std::shared_ptr<tuple_instance> _tupleInstance;
    std::shared_ptr<const std::vector<std::shared_ptr<field_value>>> _fieldValues;

    std::shared_ptr<field_value> findValue(
        const field_id_b& userFieldId
        );
};

}} // namespace test_wrappers::storage
